//
//  TravelltineraryViewController.m
//  TravelFirst
//
//  Created by lanou3g on 15/9/18.
//  Copyright (c) 2015年 吴娅君. All rights reserved.
//

#import "TravelltineraryViewController.h"
#import "TravelRouteCollectionViewController.h"
#import "TravelSpecialTableViewController.h"
@interface TravelltineraryViewController ()
@property (nonatomic, strong) TravelSpecialTableViewController *travelTableVC;
@property (nonatomic, strong) TravelRouteCollectionViewController *travelCollectionVC;

@end

@implementation TravelltineraryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.travelTableVC = [[TravelSpecialTableViewController alloc] init];
    [self addChildViewController:self.travelTableVC];
    
    self.travelCollectionVC = [[TravelRouteCollectionViewController alloc] init];
    //self.travelCollectionVC.view.frame = CGRectMake(0, 64, kWidth, kHeight - 64 - 49);
    [self addChildViewController:self.travelCollectionVC];
    
    [self.view addSubview:self.travelCollectionVC.view];
    
    UISegmentedControl *seg=[[UISegmentedControl alloc]initWithItems:@[@"路线库",@"路线专题"]];
    seg.frame=CGRectMake(0, 0, kWidth-100, 30);
    seg.selectedSegmentIndex=0;
    self.navigationItem.titleView=seg;
    [seg addTarget:self action:@selector(transformView:) forControlEvents:UIControlEventValueChanged];
}

- (void)transformView:(UISegmentedControl *)segmentedControl
{
    if (segmentedControl.selectedSegmentIndex == 0) {
        
        [UIView transitionFromView:self.travelTableVC.view toView:self.travelCollectionVC.view duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve completion:nil];
    } else {
        [UIView transitionFromView:self.travelCollectionVC.view toView:self.travelTableVC.view duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve completion:nil];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}



@end
